package com.cloud.workTest;

public class SplitTest {
    public static void main(String[] args) {
        String str = "1,admin,1,登入,1,\"{\"\"userAccount\"\":\"\"admin\"\",\"\"userType\"\":\"\"1\"\",\"\"userName\"\":\"\"admin\"\"}\",2023-06-07 11:37:48,2023-06-07 11:37:48";
        // 使用正则表达式匹配
        String[] fields = str.split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)", -1);
        // 遍历输出拆分的结果
        for (String s:fields){
            System.out.println(s);
        }
        // 输出完整的数据
        System.out.println(str);

        String string = "Data too long for column 'component_rel_info' at row 4";

        System.out.println(string.indexOf("'"));
        System.out.println(string.lastIndexOf("'"));
        System.out.println(string.substring(string.indexOf("'"), string.lastIndexOf("'")));
    }
}
